<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        // function fn() {
        //     console.log('打印一次');

        // }
        // let xh1 = setInterval(fn, 300)
        // function fnn() {
        //     console.log('第二个定时器');
        // }
        // let xh = setInterval(fnn, 1000)
        // clearInterval(xh)
        // clearInterval(xh1)



        // console.log(xh);
        // console.log(xh1);
        let i = 1
        let timt = setInterval(function () {
            i++
            console.log(i);
            if (i === 5) {
                clearInterval(timt)
            }
        }, 1000)
    </script>
</body>

</html>